package model

import (
	"manager/model/entity"
	"manager/model/po"
)

// CyclingRecodeCreateRequest 创建现场数据
type CyclingRecodeCreateRequest struct {
	UserId int64 `json:"user_id"`

	EbikeId int64 `json:"ebike_id"`

	TotalMileage int `json:"total_mileage"`

	MaxRideMileage int `json:"max_ride_mileage"`

	AccompanyDays int `json:"accompany_days"`

	UpdatedAt int64 `json:"updated_at"`
}

// CyclingRecodeUpdateRequest 更新现场数据
type CyclingRecodeUpdateRequest struct {
	Id int64 `json:"id"`

	UserId *int64 `json:"user_id"`

	EbikeId *int64 `json:"ebike_id"`

	TotalMileage *int `json:"total_mileage"`

	MaxRideMileage *int `json:"max_ride_mileage"`

	AccompanyDays *int `json:"accompany_days"`

	CreatedAt int64 `json:"created_at"`

	UpdatedAt *int64 `json:"updated_at"`
}

// CyclingRecodeListRequest 列表现场数据
type CyclingRecodeListRequest struct {
	Index int `json:"index"`
	Size  int `json:"size"`

	Id int64 `json:"id"`

	UserId *int64 `json:"user_id"`

	EbikeId *int64 `json:"ebike_id"`

	TotalMileage *int `json:"total_mileage"`

	MaxRideMileage *int `json:"max_ride_mileage"`

	AccompanyDays *int `json:"accompany_days"`

	UpdatedAt *int64 `json:"updated_at"`
}

// CyclingRecodeListResponse 列表回包数据
type CyclingRecodeListResponse struct {
	Total int                  `json:"total"`
	List  []*CyclingRecodeInfo `json:"list"`
}

// CyclingRecodeInfoRequest 列表现场数据
type CyclingRecodeInfoRequest struct {
	Id int64 `json:"id"`

	UserId *int64 `json:"user_id"`

	EbikeId *int64 `json:"ebike_id"`

	TotalMileage *int `json:"total_mileage"`

	MaxRideMileage *int `json:"max_ride_mileage"`

	AccompanyDays *int `json:"accompany_days"`

	UpdatedAt *int64 `json:"updated_at"`
}

// CyclingRecodeInfo 详细数据
type CyclingRecodeInfo struct {
	Id int64 `json:"id"`

	UserId int64 `json:"user_id"`

	EbikeId int64 `json:"ebike_id"`

	TotalMileage int `json:"total_mileage"`

	MaxRideMileage int `json:"max_ride_mileage"`

	AccompanyDays int `json:"accompany_days"`

	Position po.Point `json:"position"`

	CreatedAt int64 `json:"created_at"`

	UpdatedAt int64 `json:"updated_at"`
}

// CyclingRecodeDeleteRequest 删除现场数据
type CyclingRecodeDeleteRequest struct {
	Id int64 `json:"id"`
}

// CyclingRecodesEntityToDto entity数据转换
func CyclingRecodesEntityToDto(cyclingRecodes []*entity.CyclingRecode) []*CyclingRecodeInfo {
	out := make([]*CyclingRecodeInfo, 0, len(cyclingRecodes))
	for _, c := range cyclingRecodes {
		out = append(out, CyclingRecodeEntityToDto(c))
	}
	return out
}

// CyclingRecodeEntityToDto entity数据转换
func CyclingRecodeEntityToDto(e *entity.CyclingRecode) *CyclingRecodeInfo {
	return &CyclingRecodeInfo{

		Id: e.Id,

		UserId: e.UserId,

		EbikeId: e.EbikeId,

		TotalMileage: e.TotalMileage,

		MaxRideMileage: e.MaxRideMileage,

		AccompanyDays: e.AccompanyDays,

		Position: e.Position,

		CreatedAt: e.CreatedAt,

		UpdatedAt: e.UpdatedAt,
	}
}
